<template>
  <div>
  <course-nav-bar/>
    <el-container>
      <div id="bigDiv">
        <el-row :gutter="20">
          <el-col :span="3" :offset="2">
            <div>
              <el-row v-if="this.test2==2">
                <el-col>
                  <div class="left-item">
                    <el-card>
                      <div slot="header" class="clearfix">
                        <span class="subheading"><i class="el-icon-s-check"></i>讲师中心</span>
                      </div>
                      <div class="item">
                        <router-link :underline="false" to="/TeacherInformation">讲师信息</router-link>
                      </div>
                      <div class="item">
                        <router-link :underline="false" to="/LoboCourse">录播管理</router-link>
                      </div>
                      <div class="item">
                        <router-link :underline="false" to="/redPacket">开源项目</router-link>
                      </div>
                    </el-card>
                  </div>
                </el-col>
              </el-row>
              <el-row v-if="this.userType==2">
                <el-col>
                  <div class="left-item">
                    <el-card>
                      <div slot="header" class="clearfix">
                        <span class="subheading"><i class="el-icon-s-check"></i>收益中心</span>
                      </div>
                      <div class="item">
                        <router-link :underline="false" to="/InCome">收益情况</router-link>
                      </div>
                    </el-card>
                  </div>
                </el-col>
              </el-row>
              <el-row>
                <el-col>
                  <div class="left-item">
                    <el-card>
                      <div slot="header" class="clearfix">
                        <span class="subheading"><i class="el-icon-s-check"></i>活动中心</span>
                      </div>
                      <div class="item">
                        <router-link :underline="false" to="/redPacket">我的红包</router-link>
                      </div>
                    </el-card>
                  </div>
                </el-col>
              </el-row>
              <el-row>
                <el-col>
                  <div class="left-item">
                    <el-card>
                      <div slot="header" class="clearfix" >
                        <span class="subheading"><i class="el-icon-s-management"></i>课程中心</span>
                      </div>
                      <div class="item">
                        <router-link :underline="false" to="/myCourses">我的课程</router-link>
                      </div>
                      <div class="item">
                        <router-link :underline="false" to="/MyCollection">我的收藏</router-link>
                      </div>
                      <div class="item">
                        <router-link :underline="false" to="/LearningRecord">学习记录</router-link>
                      </div>
                    </el-card>
                  </div>
                </el-col>
              </el-row>
              <el-row>
                <el-col>
                  <div class="left-item">
                    <el-card>
                      <div slot="header" class="clearfix">
                        <span class="subheading"><i class="el-icon-s-custom"></i>个人资料</span>
                      </div>
                      <div class="item" >
                        <router-link :underline="false" to="/PersonInformation">个人信息</router-link>
                      </div>
                      <div class="item">
                        <router-link :underline="false" to="/Changepassword">修改密码</router-link>
                      </div>
                      <div class="item">
                        <router-link :underline="false" to="/myOrder">我的订单</router-link>
                      </div>
                      <div class="item">
                        <router-link :underline="false" to="/attention">我的关注</router-link>
                      </div>
                    </el-card>
                  </div>
                </el-col>
              </el-row>
            </div>
          </el-col>
          <el-col :span="17">
            <div style="height: 1000px;overflow: auto;margin-top: 1%">
              <router-view/>
            </div>
          </el-col>
        </el-row>
      </div>
    </el-container>
    <bottom/>
  </div>
</template>

<script>
  import CourseNavBar from "../course/CourseNavBar";
  import Bottom from "../Bottom";
  import qs from 'qs'
export default {
  name: "PersonalCenterBody",
   components: {Bottom, CourseNavBar,},
  created() {
    console.log(this.$router.currentRoute.name);
    console.log(this.$router.currentRoute.path);
    this.findAll();
  },
  data() {
    return {
      activeName: 'first',
      user:{
        uid:sessionStorage.getItem('uid'),
      },
      userType:'',
      test:sessionStorage.getItem('uid'),
      test2:sessionStorage.getItem('usertype'),
    };
  },
  methods: {
    handleClick(tab, event) {
      console.log(tab, event);
    },
    findAll(){
      this.$axios.post("/order/orderInfo/findOneUser",qs.stringify(this.user)).then(res=>{
        this.userType = res.data.userType;
      })
    }
  }
}
</script>

<style>
  a {
    text-decoration: none;
    color: black;
  }
  .item :hover{
    color: crimson;
  }
  #bigDiv{
    width: 1500px;
    height: 1100px;
    margin: auto;
  }
  .left-item{
    margin-top: 10px;
    text-align: center;
  }
  .subheading{
    font-weight: bold;
  }
  .item{
    padding: 3px;
    line-height: 30px;
    font-size: 15px;
  }
</style>
